home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / c.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.5 KB  |  80 lines

  1. /*
  2.  * Copyright (c) 1991 Carnegie Mellon University
  3.  * All Rights Reserved.
  4.  * 
  5.  * Permission to use, copy, modify and distribute this software and its
  6.  * documentation is hereby granted, provided that both the copyright
  7.  * notice and this permission notice appear in all copies of the
  8.  * software, derivative works or modified versions, and any portions
  9.  * thereof, and that both notices appear in supporting documentation.
  10.  *
  11.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  12.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  13.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14.  *
  15.  * Carnegie Mellon requests users of this software to return to
  16.  *
  17.  *  Software Distribution Coordinator   or   Software.Distribution@CS.CMU.EDU
  18.  *  School of Computer Science
  19.  *  Carnegie Mellon University
  20.  *  Pittsburgh PA 15213-3890
  21.  *
  22.  * any improvements or extensions that they make and grant Carnegie the rights
  23.  * to redistribute these changes.
  24.  */
  25. /*
  26.  * Standard C macros
  27.  *
  28.  **********************************************************************
  29.  * HISTORY
  30.  * 02-Feb-86  Glenn Marcy (gm0w) at Carnegie-Mellon University
  31.  *    Added check to allow multiple or recursive inclusion of this
  32.  *    file.  Added bool enum from machine/types.h for regular users
  33.  *    that want a real boolean type.
  34.  *
  35.  * 29-Dec-85  Glenn Marcy (gm0w) at Carnegie-Mellon University
  36.  *    Also change spacing of MAX and MIN to coincide with that of
  37.  *    sys/param.h.
  38.  *
  39.  * 19-Nov-85  Glenn Marcy (gm0w) at Carnegie-Mellon University
  40.  *    Changed the number of tabs between TRUE, FALSE and their
  41.  *    respective values to match those in sys/types.h.
  42.  *
  43.  * 17-Dec-84  Glenn Marcy (gm0w) at Carnegie-Mellon University
  44.  *    Only define TRUE and FALSE if not defined.  Added caseE macro
  45.  *    for using enumerated types in switch statements.
  46.  *
  47.  * 23-Apr-81  Mike Accetta (mja) at Carnegie-Mellon University
  48.  *    Added "sizeofS" and "sizeofA" macros which expand to the size
  49.  *    of a string constant and array respectively.
  50.  *
  51.  **********************************************************************
  52.  */
  53.  
  54. #ifndef    _C_INCLUDE_
  55. #define    _C_INCLUDE_
  56.  
  57. #define ABS(x) ((x)>=0?(x):-(x))
  58. #define    MIN(a,b) (((a)<(b))?(a):(b))
  59. #define    MAX(a,b) (((a)>(b))?(a):(b))
  60.  
  61. #ifndef    FALSE
  62. #define FALSE    0
  63. #endif    FALSE
  64. #ifndef    TRUE
  65. #define TRUE    1
  66. #endif    TRUE
  67.  
  68. #define    CERROR        (-1)
  69.  
  70. #ifndef    bool
  71. typedef enum    { false = 0, true = 1 } bool;
  72. #endif    bool
  73.  
  74. #define    sizeofS(string)    (sizeof(string) - 1)
  75. #define sizeofA(array)    (sizeof(array)/sizeof(array[0]))
  76.  
  77. #define caseE(enum_type)    case (int)(enum_type)
  78.  
  79. #endif    _C_INCLUDE_
  80.